package oa.hleast.xswl.mapper.appsicon;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import oa.hleast.xswl.pojo.domain.appsicon.CmsAppsIcon;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 302
 * @description
 * @date 2021/3/12
 */
@Mapper
public interface AppsIconMapper extends BaseMapper<CmsAppsIcon> {

    @Select("select * from cms_apps_icon_client caic left join cms_apps_icon ai  on ai.id = caic.apps_icon_id " +
            "where caic.client_type = #{authClientId} and ai.dict_item_apps_icon_type_id = #{dictItemAppsIconTypeId} " +
            "and ai.display = #{homePageIconDisplay} and ai.deleted = 0 and caic.deleted = 0 limit #{start},#{end}")
    List<CmsAppsIcon> findAppsIconTypeByClient(Integer homePageIconDisplay, Long dictItemAppsIconTypeId, String authClientId, Integer start, Integer end);

    @Select("select count(1) from cms_apps_icon_client caic left join cms_apps_icon ai on ai.id = caic.apps_icon_id " +
            "where caic.client_type = #{authClientId} and ai.dict_item_apps_icon_type_id = #{dictItemAppsIconTypeId} " +
            "and ai.display = #{homePageIconDisplay} and ai.deleted = 0 and caic.deleted = 0 ")
    Integer countAppsIconTypeByClient(Integer homePageIconDisplay, Long dictItemAppsIconTypeId, String authClientId);

}
